#-------------------------------------------------------------------------------
# @file 	CMakeLists
# @author 	mojinpan
# @copyright (c) 2018-2024 mojinpan. All rights reserved.
# @brief 	mosquitto编译脚本
# @version 	V0.1
# @date 	2024-08-27
#
# @brief 	功能说明
# @details
# 1.自动添加头文件给主cmake
# 2.自动将库名称信息添加到 STATIC_LIB_LIST 变量回传给主cmake
# 3.自动将库路径信息添加到 LIB_LINK_DIR 变量回传给主cmake
# 4.自动将头文件路径信息添加到 INCLUDE_DIR 变量回传给主cmake
#
# @version 	V0.1
# @date 	2024-08-27
# @details
# 1.实现第三方库的引用
# 2.实现按文件夹命名库名称
# 3.实现头文件和库名称共享给主cmake
#-------------------------------------------------------------------------------
# 导入编译好的动态库
add_library(crypto SHARED IMPORTED)
add_library(ssl SHARED IMPORTED)
add_library(mosquitto SHARED IMPORTED)

# 将动态库添加到动态库列表(该列表由主CMake提供)
if(DEFINED SHARED_LIB_LIST)
  set(SHARED_LIB_LIST ${SHARED_LIB_LIST} crypto ssl mosquitto PARENT_SCOPE)
else()
  message(FATAL_ERROR "The variable SHARED_LIB_LIST is not defined!")
endif()

#添加库的链接路径(该列表由主CMake提供)
if(DEFINED LIB_LINK_DIR_LIST)
  set(LIB_LINK_DIR_LIST ${LIB_LINK_DIR_LIST} ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
else()
  message(FATAL_ERROR "The variable LIB_LINK_DIR_LIST is not defined!")
endif()

# 添加头文件路径(该列表由主CMake提供)
if(DEFINED LIB_INCLUDE_DIR_LIST)
  set(LIB_INCLUDE_DIR_LIST ${LIB_INCLUDE_DIR_LIST} ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
else()
  message(FATAL_ERROR "The variable LIB_INCLUDE_DIR_LIST is not defined!")
endif()

